import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import styleImport, { VantResolve } from "vite-plugin-style-import";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    styleImport({
      resolves: [VantResolve()],
      libs: [
        {
          libraryName: "vant",
          esModule: true,
          resolveStyle: (name) => `../es/${name}/style`,
        },
      ],
    }),
  ],
  server: {
    proxy: {
      // "/api": {
      //   target: "http://ceshi13.dishait.cn", //这里填入你要请求的接口的前缀
      //   changeOrigin: true, //虚拟的站点需要更换origin
      //   rewrite: (path) => path.replace(/^\/api/, ""), //重写路径
      // },
      "/api2": {
        target: "http://kumanxuan1.f3322.net:8001", //这里填入你要请求的接口的前缀
        changeOrigin: true, //虚拟的站点需要更换origin
        rewrite: (path) => path.replace(/^\/api2/, ""), //重写路径
      },
    },
  },
});
